package com.musicserver.controller;

import com.musicserver.common.R;
import com.musicserver.model.request.AdminRequest;
import com.musicserver.service.AdminService;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdminController {
    @Autowired
    private AdminService adminService;

    /**
     * 管理员登录验证接口
     * 处理管理员登录请求，验证用户名和密码
     *
     * @param adminRequest 包含管理员登录信息的请求对象（用户名和密码）
     * @param session HTTP会话对象，用于存储登录状态
     * @return 返回登录验证结果，包含登录成功或失败的信息
     */
    @PostMapping("/admin/login/status")
    public R loginStatus(@RequestBody AdminRequest adminRequest,
                         HttpSession session) {
        R result = adminService.verityPasswd(adminRequest, session);
        return result;
    }
}